//
//  DevTestPlugin.m
//  PushInappTestiOS
//
//  Created by KyuJin on 12. 12. 29..
//
//

#import "DevTestPlugin.h"
#import "AppManager.h"

@implementation DevTestPlugin

- (void) devtest:(CDVInvokedUrlCommand *)command
{
    CDVPluginResult* pluginResult = nil;
    NSString* message = [command.arguments objectAtIndex:0];
    
    if (message != nil && [message length] > 0) {
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
    } else {
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
    }
    
    [[AppManager getInstance] showAlertDialog:@"DevTest" with:message];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    
    
    // Threading !
    //    // Check command.arguments here.
    //    [self.commandDelegate runInBackground:^{
    //        NSString* payload = nil;
    //        // Some blocking logic...
    //        CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload];
    //        // The sendPluginResult method is thread-safe.
    //        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    //    }];
}


@end
